import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
//import store from './components/redux/store'
import {theReducer} from './components/redux/reducer'
import {applyMiddleware, createStore} from 'redux';
import logger from 'redux-logger';
import thunk from 'redux-thunk'
import {Provider} from 'react-redux';
import {BrowserRouter} from 'react-router-dom'

/*const render=()=>{
    console.log('index.js render run ');
    ReactDOM.render(<App />, document.getElementById('root'));
};


render();

store.subscribe(render);*/

const store = createStore(theReducer, applyMiddleware(logger, thunk));

ReactDOM.render(
    <BrowserRouter>
        <Provider store={store}>
            <App/>
        </Provider>
    </BrowserRouter>
    ,
    document.getElementById('root')
);


// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();
